UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6s1lt+guiYYtmBbB+A7BIvlzyPG24P0UxOLk6q9ITLM='
WHERE
key_id = 'e8145f765ad99e6ed8a09cd8747dae66e8b13a1a6c1b4ab42d13899518808fb0'
AND (
token = '6s1lt+guiYYtmBbB+A7BIvlzyPG24P0UxOLk6q9ITLM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)