UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'le4EhQeF4HAwZllXvvUsnJQ22N08sFLkxzVkpeVurVI=' 
WHERE 
  key_id = '8a42ad4e6d60d60e96b30da2501a73d52c386b14c29094cbc3fd66d83c6b60fb' 
  AND (
    token = 'le4EhQeF4HAwZllXvvUsnJQ22N08sFLkxzVkpeVurVI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025