UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'USZt8iIBIjOVDQF1cH0HV2k7qchU8DkTlAekgvqhvUo='
WHERE
key_id = 'cb46e47348875eddbc58284dd7edf63833c108c6262b29f11ce46b4ef126eb5a'
AND (
token = 'USZt8iIBIjOVDQF1cH0HV2k7qchU8DkTlAekgvqhvUo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)