UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'G+AN4RezBp4wfgRCb4jgFFl0hchIKE5CPG9Y8CNwDPQ=' 
WHERE 
  key_id = '752e3fc18a646559810c1e7e79d5bc39f701f2e7157bfe86202ba7632c43818d' 
  AND (
    token = 'G+AN4RezBp4wfgRCb4jgFFl0hchIKE5CPG9Y8CNwDPQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041