UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sw56LmiB6TzhQVSFL6MtnJ5qm2d57GoI8j9e3MUpM1M=' 
WHERE 
  key_id = '0b7e98c5c4465270cca787de5706b665ca849731f013557ff8e3e3c11fc77054' 
  AND (
    token = 'sw56LmiB6TzhQVSFL6MtnJ5qm2d57GoI8j9e3MUpM1M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036