UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'K/V1Tyy5e4ySrc9Ngdp01KlG2q521Pkm7Mf12dgynGk='
WHERE
key_id = 'd9cf7cbdee37586fdc43697eff466f831a768b4b5e6af32e0ae65542097911f0'
AND (
token = 'K/V1Tyy5e4ySrc9Ngdp01KlG2q521Pkm7Mf12dgynGk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)