UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'nEXgISpRCCHySJlz1FN1qjtCM5FuGu5aT6QwAg+jlc0='
WHERE
key_id = 'c8d6f11afbf41bb097fbecba1f02a061f88986863b1fb0d08acd28c89ea1dd9a'
AND (
token = 'nEXgISpRCCHySJlz1FN1qjtCM5FuGu5aT6QwAg+jlc0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)