UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NiLJzLTf76n++bNG3bdd6MkZRchCOXhsZgnKpm3iJJ8='
WHERE
key_id = 'a98ff3cc89166dc93a117ddfb50c423213418c54c2c32c432fa46a70904d64ed'
AND (
token = 'NiLJzLTf76n++bNG3bdd6MkZRchCOXhsZgnKpm3iJJ8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)