UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZzXPhl5Qgnh12U35ByT9GZDVLnlu2lcl2tgCf3GcXrw=' 
WHERE 
  key_id = '628086e4bb48a97d15d60e4c050729e369383add029c2841db703d3e9fb749be' 
  AND (
    token = 'ZzXPhl5Qgnh12U35ByT9GZDVLnlu2lcl2tgCf3GcXrw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020