UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Z9vK1Y1uhfJb7YFKY1/CSERKPRzs43Wy6Baqfm2K/Ow='
WHERE
key_id = 'af59018ccc121d1cd4bddac35067dd52ed804820de7746b949584a3d6c709456'
AND (
token = 'Z9vK1Y1uhfJb7YFKY1/CSERKPRzs43Wy6Baqfm2K/Ow='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)