UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RS0WopH2Wm2gPBDlNHEUfK106c9gp9z3UPkP86ux250=' 
WHERE 
  key_id = '36a712e66439b53cad67be1658c672979b8bdcec4807330177d2fa06fbed904c' 
  AND (
    token = 'RS0WopH2Wm2gPBDlNHEUfK106c9gp9z3UPkP86ux250=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024