UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BH49GC7zG0bozf3bWK/AFwdNnHdc8QOyIGGiq6DToHk='
WHERE
key_id = 'a6d64109c683adc2c7a1a206aa93bde0670a9467ee34a0cdd261b3b3e36ee2bd'
AND (
token = 'BH49GC7zG0bozf3bWK/AFwdNnHdc8QOyIGGiq6DToHk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)