UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '99BoarM8JTWNiOwge8ypIQXgPYZAnrQXrdWbdVF7kwU='
WHERE
key_id = '405b4d222a75c3bd920740cc319e6aa96cdd4e1642c1c2c2153a052ccca63703'
AND (
token = '99BoarM8JTWNiOwge8ypIQXgPYZAnrQXrdWbdVF7kwU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)