UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sXu6iiwkUB5+zIDmuVHAGB0WpIfHtgMWTLSnIH+REwo='
WHERE
key_id = '2c9ed01db5de0e5e9f9e84787d510ffcc1176ed548c093676febae4b4557f8b2'
AND (
token = 'sXu6iiwkUB5+zIDmuVHAGB0WpIfHtgMWTLSnIH+REwo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)