UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'W8bi0ABpfk4RLeRtEJFvhmh7VltghrhibapolPqrw2o=' 
WHERE 
  key_id = 'd225e93ef5d9563de73ce6fce81d988b5922342c61ade5db968374b3b4aa5e77' 
  AND (
    token = 'W8bi0ABpfk4RLeRtEJFvhmh7VltghrhibapolPqrw2o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026