UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fWvkveFJtlD4Ze7mv3smJRFXSvUEU6zuP3dwqh874hA=' 
WHERE 
  key_id = '7f068051d15b4604774d0440ae09206eb923de71443284f158331dbdd677be03' 
  AND (
    token = 'fWvkveFJtlD4Ze7mv3smJRFXSvUEU6zuP3dwqh874hA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00081