UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Lch+RiGVvKLYbaFRgY4YlYeIsyXEeAy15h7VSE5FPCE='
WHERE
key_id = 'b9298136660479a6e22832f5e524a089b324fb44a5be196e02a271b05177e4d1'
AND (
token = 'Lch+RiGVvKLYbaFRgY4YlYeIsyXEeAy15h7VSE5FPCE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)