UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dl2Ou3Mw7jomIl6uh5QDz1Dj44lmXAD89wi+RCzTmG0='
WHERE
key_id = 'a58d4b976fde95aff15cec6c558cb13c7485f97487b3e45342548bc4603b6d22'
AND (
token = 'dl2Ou3Mw7jomIl6uh5QDz1Dj44lmXAD89wi+RCzTmG0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)