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