UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xkg9btEaNUD3dT1uEhQVH+mm92qTcK8p6KNcSpnBOf0=' 
WHERE 
  key_id = '9a033b2ac0526f5a72ade380733caf90011cfce466152eff82063bdf07fcc527' 
  AND (
    token = 'xkg9btEaNUD3dT1uEhQVH+mm92qTcK8p6KNcSpnBOf0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00055