UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9/fkb6M/0kyoJDFP+XPQhKsvt9ufXsOErSiBRh8G46g='
WHERE
key_id = '4d7ab9b510eb5c208f2283b84df26259b1d92ddfd3aae66660053916722cd25e'
AND (
token = '9/fkb6M/0kyoJDFP+XPQhKsvt9ufXsOErSiBRh8G46g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)