UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'yUqb4jynsvawVpRD+kEucmzHM61L+Y+1N4/z0NQNYk4='
WHERE
key_id = 'ad7390230f9c6080a3f40b4e5554c4b216564018ba2ff962d97c42ccdbce5276'
AND (
token = 'yUqb4jynsvawVpRD+kEucmzHM61L+Y+1N4/z0NQNYk4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)