UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3QUp0AI+hg1hB0werhXZ4/bnATnkT7wCFLSoqhjF0N4='
WHERE
key_id = '74764ba180f2624831f7e301e38d9c24d47baabee25e0628600b6dfebe748e04'
AND (
token = '3QUp0AI+hg1hB0werhXZ4/bnATnkT7wCFLSoqhjF0N4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)