UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'x3IT+G6BTvDKodBArrUrSJKDfx6GUfJXq6un443qwfU='
WHERE
key_id = 'dc5bf57b5946f48030a96ae0890e2abe385ee2bffddd984204a2e290ee2c20cf'
AND (
token = 'x3IT+G6BTvDKodBArrUrSJKDfx6GUfJXq6un443qwfU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)