UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sYzYhlGwkLqLYInJ0iQ82FmMtVsCEd8I+o7hud2Se5k='
WHERE
key_id = 'a7369ccb1c567e031a05a6d55c15135ba9b85a1bb5f8afe4890aa87441ffcb9d'
AND (
token = 'sYzYhlGwkLqLYInJ0iQ82FmMtVsCEd8I+o7hud2Se5k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)