UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '19NIqtzQ08fhZ38g7XAtSycMCOVb+0SZbb83cuqemp8=' 
WHERE 
  key_id = 'f66e52ab889403492f787d7bcdd7c13ff9d1b6074263b3c4de1fd704d7e850cb' 
  AND (
    token = '19NIqtzQ08fhZ38g7XAtSycMCOVb+0SZbb83cuqemp8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028