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