UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'm5T2vCdWLB6ZBDwpYudQz7X2ZL8jKiEnt7+XwrLq12o='
WHERE
key_id = 'a1f13265c131a16b13852acf9d50cdf209f36b805a3c5203feef79c593ebe4b1'
AND (
token = 'm5T2vCdWLB6ZBDwpYudQz7X2ZL8jKiEnt7+XwrLq12o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)