UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'q7vynK1OljKg1+mp/ZAP6nSdUzV1CrHOkUR13rLjHLs='
WHERE
key_id = 'b1059dc45da7bf1a876a7b7b308c45ef975f5b3a3e081bf90d5487a03574398f'
AND (
token = 'q7vynK1OljKg1+mp/ZAP6nSdUzV1CrHOkUR13rLjHLs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)