UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BiHErHpoIDF7oEhKhYBmqgKwu2/EMpBC0AohEmPGbDo='
WHERE
key_id = 'c9a2b50b8f524b688b5fa68629e04e62fc331ec47931da952122a730f5ba342e'
AND (
token = 'BiHErHpoIDF7oEhKhYBmqgKwu2/EMpBC0AohEmPGbDo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)