UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'C4DaRK67lEig64WyK70XbUCBJlRIpUFscziD/KrQq2E=' 
WHERE 
  key_id = 'b95dc837c3486da3673b6b494471ab8a28ac11267328e6ad34e70a471e53688f' 
  AND (
    token = 'C4DaRK67lEig64WyK70XbUCBJlRIpUFscziD/KrQq2E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022