UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'huVV8j6CzRA7Y1ATa6iN5F/mbIpzfNvCrXupefg5pZU='
WHERE
key_id = '417eae37bd7e97e23cb57edcc7bf610efbbcd77bc8550db3e867439b3e34fe99'
AND (
token = 'huVV8j6CzRA7Y1ATa6iN5F/mbIpzfNvCrXupefg5pZU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)