UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'UUpqWifVx+gDaGRX/8iCeWfzPSCRz6rGBfLMgEy9S7Y='
WHERE
key_id = 'd023928ec2054363a2ca454d325558ac246c488b53f6001260b2847e455c698a'
AND (
token = 'UUpqWifVx+gDaGRX/8iCeWfzPSCRz6rGBfLMgEy9S7Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)