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