UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 's9DDmi2j85lIHCcyCdyJ+tveIX/LsCbOzqz/TSO4LTU='
WHERE
key_id = '1f08132cde4d83796c4eac76740c2a72dc93c3d0a55801908a9426a572cf31ca'
AND (
token = 's9DDmi2j85lIHCcyCdyJ+tveIX/LsCbOzqz/TSO4LTU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)