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