UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'j1N2U++t9PSckyw5Ok2Oh2GO7pnX7FlGzUB2Q7Oqmhk='
WHERE
key_id = 'f59ef6df414705300e673833b5853d871c665ec8af0a03c2cd0cfb18b61fa761'
AND (
token = 'j1N2U++t9PSckyw5Ok2Oh2GO7pnX7FlGzUB2Q7Oqmhk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)