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

Query time 0.00116