UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'mSW0zkuGLDvaUb4qXL3BbOAJcm9mQouxReaWbPjrRmg='
WHERE
key_id = '065762ec83316a2638d55ccee3c37e6f4fba197d32b65c93e82643f95ea7d83b'
AND (
token = 'mSW0zkuGLDvaUb4qXL3BbOAJcm9mQouxReaWbPjrRmg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)