UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'FRPElf1tKTZblCIpX6B1bB1xK364fGTfw76fAFMBZf8='
WHERE
key_id = 'dd5989d4dd45e2bb1a4b44514cd5924878ff30ab205657d9fb105d984966cebc'
AND (
token = 'FRPElf1tKTZblCIpX6B1bB1xK364fGTfw76fAFMBZf8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)