UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Z1LqtI0iizzKcpXxEwrXL1wf7qsGe/FoHD5gttXSVuY=' 
WHERE 
  key_id = 'fc115e285a556be96d7bdf6e29412384126ee65ba5e5707d1f1382272305a642' 
  AND (
    token = 'Z1LqtI0iizzKcpXxEwrXL1wf7qsGe/FoHD5gttXSVuY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023