UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lf27+3nICbOF/txjcb67yh3Bp1s73RKFFugfroSDzzc=' 
WHERE 
  key_id = '8aa6e0ec9139ab3535d0a33e595c2527fc747c1438cf8918538fa6eb93be2a9e' 
  AND (
    token = 'lf27+3nICbOF/txjcb67yh3Bp1s73RKFFugfroSDzzc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025