UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qBRBHpBFExoSll3/V705E31Dqe9JaVQm2jfvrm3v5Tc='
WHERE
key_id = '471ffbffdce5ac021fdcc10da712d6e18f9d4e4fbed3292c8099afbb4bc38399'
AND (
token = 'qBRBHpBFExoSll3/V705E31Dqe9JaVQm2jfvrm3v5Tc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)