UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9mjZCSwcWIMfwKFbti46CiW1kDS1FIMYEjpNPjEdS1w='
WHERE
key_id = 'ac4a1dfd3fb12e79548d4f9f909ff296b448b1423300e7ffd4454648e3080451'
AND (
token = '9mjZCSwcWIMfwKFbti46CiW1kDS1FIMYEjpNPjEdS1w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)