UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Plqxgzlv7B4T6eLNZP3XgAy7e7CqIJh3MurMqXgE6mw=' 
WHERE 
  key_id = '31cce0f46712272ba938c53a3418a76edba95089f2677455b03776538482d9cd' 
  AND (
    token = 'Plqxgzlv7B4T6eLNZP3XgAy7e7CqIJh3MurMqXgE6mw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022