UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'LsgU9q+GiqyGYWuuSYI3ESvXb5RyPwjgwypdfjHEtVE='
WHERE
key_id = '1713a965e2881901a940adfc335c4f0eae6acc922020bcfe84d0c29fd4666a53'
AND (
token = 'LsgU9q+GiqyGYWuuSYI3ESvXb5RyPwjgwypdfjHEtVE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)