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