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