UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3+RSkcBzx9g1L+ILFRgb53QPlD24wr8Iku1aAbo3il8=' 
WHERE 
  key_id = 'cef82066a900d3607a874de85c1594d9f0971424218c25df712fff4792408bb3' 
  AND (
    token = '3+RSkcBzx9g1L+ILFRgb53QPlD24wr8Iku1aAbo3il8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053